package com.taojiazheng.controller.user;

import com.taojiazheng.common.ResultResponse;
import com.taojiazheng.service.user.UserService;
import com.taojiazheng.so.user.UserSo;
import com.taojiazheng.vo.user.UserVo;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 赵成林
 * @date 2017/11/22 21:05
 * 用户注册
 */
@Controller
@RequestMapping(value = "user")
public class RegisterController {
    public Logger logger = Logger.getLogger(RegisterController.class);
    @Autowired
    private UserService userService;
    @ResponseBody
    @RequestMapping(value = "register",method = RequestMethod.POST)
    public ResultResponse register(@RequestBody UserSo userSo){
        logger.info("userName: "+userSo.getUserName()+"  "+"password: "+userSo.getPassword());
        UserVo userVo = userService.register(userSo);
        return new ResultResponse(userVo);
    }

}
